<template>
  <Dialog ref="dialog" width="600" title="备注">
    <el-input
      v-model="textarea"
      maxlength="500"
      placeholder="请输入备注信息"
      show-word-limit
      :rows="6"
      type="textarea"
    />
    <el-divider />
    <div style="display: flex; align-items: center; justify-content: flex-end">
      <el-button type="primary" @click="surechange">确定</el-button>
    </div>
  </Dialog>
</template>
<script setup>
import { ref } from 'vue';
import Dialog from '@/components/Dialog/Dialog.vue';
import { reserveExperts } from '@/api/leader/Filling.js';
import { ElMessage } from 'element-plus';

const emit = defineEmits(['refrehsList']);

const dialog = ref(null);
const textarea = ref('');
const reserveInfo = ref({});

// 调用子组件的方法
function surechange() {
  reserveInfo.value.remark = textarea.value;
  reserveExperts(reserveInfo.value).then(() => {
    ElMessage({
      type: 'success',
      message: '修改成功',
    });
    dialog.value.closeChange();
    emit('refrehsList');
  });
}

function openChange(val) {
  reserveInfo.value = val;
  textarea.value = val.remark;
  dialog.value.openChange();
}
defineExpose({
  openChange,
});
</script>
<style lang="scss" scoped></style>
